<?php
declare (strict_types=1);

namespace app\index\controller;

use addons\V4\admin\model\ProductCate;
use app\common\model\Carousel;
use think\facade\Cache;
use think\facade\View;

class Index extends Base
{

    public function index()
    {
        View::assign([
            'carousel' => Carousel::getList(),
            'cate'     => ProductCate::where(['status' => 1, 'pid' => 0])->select(),
            'news'     => \app\common\model\News::getList()
        ]);
        return View::fetch();
    }

    public function communal()
    {
        $type = $this->request->param('type');
        $title = ['privacy_msg' => '注册协议'];

        View::assign([
            'title'   => $title[$type],
            'content' => Cache::get('system')[$type]
        ]);
        return View::fetch();
    }
}
